import {
  createStore
} from 'vuex'

export default createStore({
  state: {
    count: 0
  },
  getters: {
    doubleCount: state => state.count * 2
  },
  mutations: {
    addCount(state, payload = 1) {
      state.count += payload;
    }
  },
  actions: {
    asyncAddCount(context) {
      setTimeout(() => {
        context.commit('addCount');
      }, 1500)
    }
  },
  modules: {}
})